function [iimg] = load_iimg_data(file_name)


if nargin < 1
    disp('usage: load_labview_acute(file_name[, file_format])');
    return;
end

meta_info_size=2;

%% try to open file, otherwise quit
[fi, message] = fopen(file_name, 'r', 'ieee-be');

status = 0;
data = [];
scanrateA = [];

if fi == -1
    disp('There was a problem reading the following file:');
    disp(file_name);
    disp(message);
    status = -1;
    return;
end

%% get file size

meta_info = fread(fi, meta_info_size, 'int16');
size_x=meta_info(2);%-meta_info(3);
size_y=meta_info(1);%-meta_info(4);

fseek(fi, 0, 'eof');
file_size = ftell(fi);
fclose(fi);


%% open the file again - this time to read in the data
fi = fopen(file_name, 'r', 'ieee-be');

%% get all header information


% double = 8 bytes, uint8 = 1 byte
nbr_frames=(file_size-meta_info_size*2)/(size_x*size_y)/2;
iimg=zeros(size_x,size_y,nbr_frames,'int16');

for ind=1:nbr_frames
    iimg(:,:,ind) = int16(reshape(fread(fi, size_x*size_y, 'int16'),size_x,size_y));
end

%% read in the data

fclose(fi);


%% EOF
